import axios from 'axios'
// 封装获取列表的请求
export function fetachGetList(params) {
  return axios({
    url: 'http://localhost:3001/data',
    method: 'GET',
    params
  })
}
// 新增
export function fetachAddList(data) {
  return axios({
    url: 'http://localhost:3001/data',
    method: 'POST',
    data
  })
}
// 编辑
export function fetachEditList(data) {
  return axios({
    url: `http://localhost:3001/data/${data.id}`,
    method: 'PUT',
    data
  })
}
// 详情
export function fetachDetailList(id) {
  return axios({
    url: `http://localhost:3001/data/${id}`,
    method: 'GET'
  })
}
// 删除
export function fetachDelList(id) {
  return axios({
    url: `http://localhost:3001/data/${id}`,
    method: 'DELETE'
  })
}
// 搜索
export function fetachSerachList(val) {
  return axios({
    url: `http://localhost:3001/data/?name=${val}`,
    method: 'GET'
  })
}
